<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<link
	href="${staticPath}/lib/datetimepicker/0.0.11/css/bootstrap-datetimepicker.min.css"
	rel="stylesheet" type="text/css">
<link href="${staticPath}/lib/chosen/1.1.0/chosen.min.css"
	rel="stylesheet" type="text/css">
<link rel="stylesheet"
	href="${staticPath}/lib/ztree/3.5/css/zTreeStyle/zTreeStyle.css"
	type="text/css">
<script src="${staticPath}/lib/ztree/3.5/js/jquery.ztree.all-3.5.js"
	type="text/javascript"></script>
<script src="${staticPath}/js/jquery-dialog.js" type="text/javascript"></script>
<meta name="decorator" content="sysDefault" content="text/html; charset=utf-8" />
<script src="${staticPath}/js/pospay/opendialog.js" type="text/javascript"></script>

<script type="text/javascript">
var sysForm = "";
$(document).ready(function(){
	$("#key").focus();
	$("#dataForm").validate({
		submitHandler: function(form){
			var key = $.trim(form.key.value);
			$.get("${contextPath}/sys/base/form/validate?key="+key+"&id="+form.id.value,function(result){
				if(result == 0){
					Oosp_Loading('正在提交，请稍等...');
					form.submit();
				}else{
					alert("对不起,key已经存在,请重新填写!");
					$("#key").focus();
				}
			});
		},
		errorContainer: "#messageBox",
		errorPlacement: function(error, element) {
			$("#messageBox").text("输入有误，请先更正。");
			if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
				error.appendTo(element.parent().parent());
			} else {
				error.insertAfter(element);
			}
		}
});
});
</script>
</head>
<body>
	<div class="container-fluid">
		<div class="row">
			<div class="col-xs-12">
				<form:form id="dataForm" modelAttribute="sysBaseForm"
					action="${contextPath}/sys/base/form/save" method="post"
					class="form-horizontal" role="form">
					
					<div class="panel panel-default">
						<div class="panel-heading">
							<h3 class="panel-title">
								新增数据 <a class="btn btn-default btn-sm pull-right" role="button"
									href="${contextPath}/sys/base/module/list" >返回</a>
							</h3>
						</div>
						<div class="panel-body">
							<form:hidden path="id" />
							<tags:message content="${message}" />
							<div class="form-group">
								<label for="saleNo" class="col-sm-2 control-label">名称:</label>
								<div class="col-sm-6">
									<form:input id="name" path="name" maxlength="20"
										class="form-control required" />
								</div>
							</div>
							<div class="form-group">
								<label for="salenoOffline" class="col-sm-2 control-label">key:</label>
								<div class="col-sm-6">
									<form:input id="key" path="key" maxlength="128"
										class="form-control required" />
								</div>
							</div>
							<div class="form-group">
								<label for="salenoOffline" class="col-sm-2 control-label">url:</label>
								<div class="col-sm-6">
									<form:input id="url" path="url" maxlength="128"
										class="form-control required" />
								</div>
							</div>
							<div class="form-group">
								<label for="salenoOffline" class="col-sm-2 control-label">排序:</label>
								<div class="col-sm-6">
									<form:input id="orderBy" path="orderBy" maxlength="20"
										class="form-control required" />
								</div>
							</div>
							<div class="form-group">
								<label for="saleChannel" class="col-sm-2 control-label">备注:</label>
								<div class="col-sm-6">
									<form:input id="remark" path="remark" maxlength="20"
										class="form-control" />
								</div>
							</div>
							<div class="form-group">
								<label for="saleChannel" class="col-sm-2 control-label">所属模块:</label>
								<div class="col-sm-6">
									<form:hidden path="moduleId" id="moduleId" />
									<input type="text" class="form-control required" id="moduleName" value="${sysBaseForm.moduleName }" readonly="readonly" />
								</div>
							</div>
						</div>
						
						<div class="form-group">
							<div class="col-sm-offset-2 col-sm-10">
								<input class="btn btn-primary" type="submit" value="保 存" /> 
								<a class="btn btn-default" href="${contextPath}/sys/base/form/${sysBaseForm.moduleId }/list" >返 回</a>
							</div>
						</div>
					</div>
					
				</form:form>
			</div>
		</div>
	</div>
</body>
</html>